﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
public partial class zoushitu_dlt_dlt_johq : System.Web.UI.Page
{
    protected List<Model.LotteryAnnouncement> arlist = null;
    protected string[] SSQList = null;
    protected string SSQblue = null;
    protected DataTable dtPaperList = new DataTable();
    protected int jinqiCount = 0;

    protected Hashtable hqjs_dt = new Hashtable();//后区奇数
    protected Hashtable hqos_dt = new Hashtable();//后区偶数

    protected Hashtable hqjs_tiao = new Hashtable();
    protected Hashtable hqos_tiao = new Hashtable();
    protected List<List<string>> jo_list = new List<List<string>>();//存放奇数个数和偶数个数
    protected List<string> jo_tiao = new List<string>();
    protected int TiaoXing;

    protected void Page_Load(object sender, EventArgs e)
    {
        ZoushiManage.FangWenZouShi();
        if (!IsPostBack)
        {
            jinqiCount = 30;
            bindData(30);
        }
    }

    protected void bindData(int maxValue)
    {

        arlist = BLL.LotteryAnnouncement.getDatas(maxValue, 2);
        if (arlist != null)
        {
            #region 列表初始化   
            hqjs_dt.Add(45, 11);
            hqjs_dt.Add(43, 09);
            hqjs_dt.Add(41, 07);
            hqjs_dt.Add(39, 05);
            hqjs_dt.Add(37, 03);
            hqjs_dt.Add(35, 01);
            //hqjs_dt.Add(40, 11);
            //hqjs_dt.Add(39, 09);
            //hqjs_dt.Add(38, 07);
            //hqjs_dt.Add(37, 05);
            //hqjs_dt.Add(36, 03);
            //hqjs_dt.Add(35, 01);


            //hqos_dt.Add(46, 12);
            //hqos_dt.Add(45, 10);
            //hqos_dt.Add(44, 08);
            //hqos_dt.Add(43, 06);
            //hqos_dt.Add(42, 04);
            //hqos_dt.Add(41, 02);
            hqos_dt.Add(46, 12);
            hqos_dt.Add(44, 10);
            hqos_dt.Add(42, 08);
            hqos_dt.Add(40, 06);
            hqos_dt.Add(38, 04);
            hqos_dt.Add(36, 02);
            //hqjs_dt.Add(5, 11);
            //hqjs_dt.Add(4, 09);
            //hqjs_dt.Add(3, 07);
            //hqjs_dt.Add(2, 05);
            //hqjs_dt.Add(1, 03);
            //hqjs_dt.Add(0, 01);

            //hqos_dt.Add(11, 12);
            //hqos_dt.Add(10, 10);
            //hqos_dt.Add(9, 08);
            //hqos_dt.Add(8, 06);
            //hqos_dt.Add(7, 04);
            //hqos_dt.Add(6, 02);
            #endregion

            int os_allcount = 0;
            int js_allcount = 0;
            for (int i = 0; i < arlist.Count; i++)
            {
                string[] blueBall = arlist[i].LotteryNo.Split('+')[1].Split(',');
                int js_count = 0;
                int os_count = 0;
                for (int m = 0; m < blueBall.Length; m++)
                {

                    //计算条形图中每个数的个数红球
                    bindTiaoxing(1, int.Parse(blueBall[m]));
                    if (int.Parse(blueBall[m]) % 2 == 0)
                    {
                        os_count = os_count + 1;
                        os_allcount = os_allcount + 1;
                    }
                    else
                    {
                        js_count = js_count + 1;
                        js_allcount = js_allcount + 1;
                    }


                }
                List<string> list = new List<string>();
                //list.Add(arlist[i].LotteryQS);
                list.Add(js_count.ToString());
                list.Add(os_count.ToString());
                jo_list.Add(list);
            }
            #region
            foreach (DictionaryEntry de in hqjs_dt)
            {
                int a = int.Parse(de.Key.ToString());
                string b = TiaoxingDT[a].ToString();
                hqjs_tiao.Add(de.Key, b);
            }
            foreach (DictionaryEntry de in hqos_dt)
            {
                int a = int.Parse(de.Key.ToString());
                string b = TiaoxingDT[a].ToString();
                hqos_tiao.Add(de.Key, b);
            }

            jo_tiao.Add(js_allcount.ToString());
            jo_tiao.Add(os_allcount.ToString());
            #endregion
        }



    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        jinqiCount = int.Parse(DropDownList1.SelectedValue);
        bindData(int.Parse(DropDownList1.SelectedValue));

    }
    protected int[] TiaoxingDT = new int[47];
    protected void bindTiaoxing(int type, int data)
    {
        for (int i = 0; i < 47; i++)
        {
            if (type == 0)
            {
                if (data == (i + 1))
                {
                    TiaoxingDT[i] += 1;
                }
            }
            if (type == 1)
            {
                if (data == (i + 1 - 35))
                {
                    TiaoxingDT[i] += 1;
                }
            }
        }
    }

}